
import Vue from 'vue';
import VueRouter from 'vue-router';
import Home from '../views/Home.vue';  // 导入组件
import Add from '../views/add.vue';
import Edit from '../views/edit.vue';
import Login from '../views/login.vue';
import Register from '../views/register.vue';
import Upload from '../views/upload.vue';

Vue.use(VueRouter);  // 注册VueRouter

const routes = [
  { path: '/login', name: 'Login', component: Login },
  { path: '/', name: 'Home', component: Home },
  { path: '/add', name: 'Add', component: Add },
  { path: '/edit', name: 'Edit', component: Edit },
  { path: '/register', name: 'Register', component: Register },
  { path: '/upload', name: 'Upload', component: Upload },
];

const router = new VueRouter({
  mode: 'hash',  // 可选：hash模式或history模式
  routes
});

export default router;  // 导出路由实例